class Admin::TagsController < ApplicationController
  layout "admin"
  
  helper :button
  
  before_filter :login_required
  
  access_control :DEFAULT => 'admin | tags'
  
  resource_this :will_paginate => true, :path_prefix => 'admin_'
  
  def auto_complete
    re = Regexp.new("^#{params[:announcement][:tag_list]}", "i")
    @tags = Array.new
    Tag.find(:all).each do |tag|
      @tags << tag if tag.name.match re
    end
    render :layout => false
  end
  
  def cleanup
    Tag.remove_unused
    redirect_to :action => :index
  end
end
